const { defineConfig } = require('@vue/cli-service');
const webpack = require('webpack');
const AutoImport = require('unplugin-auto-import/webpack').default;

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:3000', // 修改目标地址
        changeOrigin: true,
        // pathRewrite: {
        //   '^/api': '', // 去掉请求路径中的 /api
        // },
      },
    },
  },
  configureWebpack: {
    plugins: [
      AutoImport({
        imports: ['vue'],
        dts: 'src/auto-imports.d.ts',
      }),
      new webpack.DefinePlugin({
        __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(true),
      }),
    ],
  },
});
